package com.aya.aop.asp;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

@Aspect
@Service
public class ExampleAnnotationAop {
    Logger logger = LoggerFactory.getLogger(ExampleAnnotationAop.class);

    @Pointcut("@annotation(com.aya.aop.asp.AopAnnotation)")
    public void pointcut() {
    }

    @Around("pointcut()")
    public Object doAround(ProceedingJoinPoint pjp) throws Throwable {
        logger.info("ExampleAnnotationAop:start");
        Object obj = pjp.proceed();
        logger.info("ExampleAnnotationAop:end");
        return obj;
    }

}
